/*
 * @Description:
 * @Version: 1.0
 * @Autor: yel
 * @Date: 2022-03-10 11:40:05
 * @LastEditors: zhou
 * @LastEditTime: 2022-08-20 14:54:58
 */
//定义设计稿的宽高
const designWidth = 1920;
const designHeight = 820;

let styleUtil = {
    // px转vw
    px2vw: function (_px) {
        // return (_px * 100.0) / designWidth + "vw";
        return _px + "px";
    },
    // px转vh
    px2vh: function (_px) {
        // return (_px * 100.0) / designHeight + "vh";
        return _px + "px";
    },

};


/* Echarts图表字体、间距自适应，比如间距、定位、边距也可以用该函数*/
export const fitChartSize = (size, defalteWidth = 1920) => {
    let clientWidth =
      window.innerWidth ||
      document.documentElement.clientWidth ||
      document.body.clientWidth;
    if (!clientWidth) return size;
    let scale = clientWidth / defalteWidth;
    return Number((size * scale).toFixed(3));
  };
  
export default styleUtil;
